#include<stdio.h>
using namespace std;
#include"ex4.h"

Rational::Rational(int numarator, int numitor)
{
   (*this).numitor=numitor;
   (*this).numarator=numarator;
}
Rational::Rational()
{
   (*this).numarator=0;
   (*this).numitor=0;
}
int Rational::getNumarator()
{
    int numarator;
    numarator=(*this).numarator;
    return numarator;
}
int Rational::getNumitor()
{
    int numitor;
    numitor=(*this).numitor;
    return numitor;
}
void Rational::setNumarator(int numarator)
{
    (*this).numarator=numarator;
}
void Rational::setNumitor(int numitor)
{
    (*this).numitor=numitor;
}
Rational::Rational& operator +(Rational a, Rational b)
{
    Rational sum=Rational(); 
    sum.numarator=a.getNumarator()*b.getNumitor()+a.getNumitor()*b.getNumarator();
    sum.numitor=a.getNumitor()*b.getNumitor(); 
    return sum; 
} 
Rational::Rational& operator -(Rational a, Rational b)
{
    b.numarator=-b.getNumarator();
    return a+b;
}
Rational::Rational& operator *(Rational a, Rational b)
{
    Rational produs;
    produs.numarator=a.getNumarator()*b.getNumarator();
    produs.numitor=a.getNumitor()*b.getNumitor();
    return produs;
}
Rational::Rational& operator /(Rational a, Rational b)
{
    Rational q;
    q.numarator=b.getNumitor();
    q.numitor=b.getNumarator();
    return a*q;
}



